<template>
<div class="myClient">
  <search-block>
    <template slot="button">
      <el-button type="primary" @click="search(true)">查询</el-button>
    </template>
    <el-form inline :model="model" @submit.native.prevent>
      <el-form-item label="昵称:">
        <el-input v-model="model.nickName" clearable></el-input>
      </el-form-item>
<!--      <el-form-item label="手机号:">
        <el-input v-model="model.cellNum" clearable></el-input>
      </el-form-item>-->
    </el-form>
  </search-block>
  <y-table
    ref="table"
    border
    pagination
    :getDataWay="getDataWay"
    :columns="columns">
    <el-table-column slot="avatarUrl" label="头像" align="center" header-align="center" min-width="80">
      <template v-slot="{row}">
        <el-avatar v-if="row.avatarUrl" :size="60" :src="row.avatarUrl">
          <img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png"/>
        </el-avatar>
      </template>
    </el-table-column>
  </y-table>
</div>
</template>

<script>
export default {
  name: "myClient",
  inject: ['getEnum'],
  computed:{
    getDataWay(){
      return{
        dataType: 'url',
        data: this.$api.self.webUserList,
        param: this.model
      }
    }
  },
  data(){
    return{
      model:{
        nickName: '',
        cellNum: ''
      },
      columns: [
        {
          label: "昵称",
          prop: "nickName",
          minWidth: '150'
        },
        {
          label: "头像",
          prop: "avatarUrl",
          template: true
        },
        /*{
          label: "性别",
          prop: "gender",
          minWidth: '50',
          formatter: (function(row){
            return this.$$getArrayName(row.gender, this.getEnum('personSexual'), {
              label: 'label', value: 'value'
            })
          }).bind(this)
        },*/
        {
          label: "手机号",
          prop: "cellNum",
          minWidth: '150'
        },
        {
          label: "注册时间",
          prop: "createTime",
          minWidth: '200',
          formatter(row){
            return (row.createTime || '').replace('T', ' ');
          }
        },
      ]
    }
  },
  methods:{
    search(jumpToFirst){
      this.$refs['table'].loadData(this.model, jumpToFirst);
    }
  }
}
</script>

<style scoped>

</style>